﻿using System.ComponentModel.DataAnnotations;
using Microsoft.EntityFrameworkCore;

namespace LiftHub.Data;

public class NotesContext: DbContext
{
    public DbSet<Note> Notes { get; set; }
    public string DbPath { get; }

    public NotesContext()
    {
        var folder = Environment.SpecialFolder.LocalApplicationData;
        var path = Environment.GetFolderPath(folder);
        DbPath = Path.Join(path, "Ledger.db");
    }

    protected override void OnConfiguring(DbContextOptionsBuilder options)
        => options.UseSqlite($"Data Source={DbPath}");
}

public class Note
{
    public string Title { get; set; }
    public string Context { get; set; }
    [Key]
    public int Key { get; set; }
}